<template>
  <div class="page">
    <div class="box">
      <img class="icon" src="@/assets/images/evaluationResults.png" alt="">
      <div class="title">测试完成！AI已根据您的表现，为您生成了专属学情分析</div>
      <div class="radar" id="chartDom"></div>
      <div class="fraction">当前总分：<span>485</span></div>
      <div class="statistics">
        <div class="statistics-item">
          <div class="statistics-name">
            <img src="@/assets/images/icon1.png" alt="">
            <span>冲刺院校</span>
          </div>
          <div class="statistics-type">一类高中</div>
          <div class="statistics-num">507</div>
        </div>
        <div class="statistics-item">
          <div class="statistics-name">
            <img src="@/assets/images/icon2.png" alt="">
            <span>稳妥院校</span>
          </div>
          <div class="statistics-type">二类高中</div>
          <div class="statistics-num">493</div>
        </div>
        <div class="statistics-item">
          <div class="statistics-name">
            <img src="@/assets/images/icon3.png" alt="">
            <span>保底院校</span>
          </div>
          <div class="statistics-type">三类高中</div>
          <div class="statistics-num">481</div>
        </div>
      </div>
      <a><div class="btn" @click="showTarget = true">进入我的学习主页</div></a>
    </div>
  </div>
  <a-modal v-model:open="showTarget" :width="900" :footer="null">
    <div class="u-flex u-col-center" style="flex-direction: column;">
      <div class="modal-title">
        <span>您的当前阶段目标为</span>
        <img src="@/assets/images/target.png" alt="">
      </div>
      <a-input 
        class="modal-input" 
        v-model:value="form.target" 
        placeholder="请输入" 
      />
      <div class="ai-tips">
        <img src="@/assets/images/aiIcon.png" alt="">
        <div>AI推荐的当前阶段目标为：<span>510</span>  欲速不达，读书切忌囫囵吞枣。</div>
      </div>
      <a><div class="modal-btn" @click="router.push('/')">确定</div></a>
    </div>
  </a-modal>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts';

const router = useRouter()

type EChartsOption = echarts.EChartsOption;

const form = ref({})
const showTarget = ref(false)

onMounted(() => {
  var chartDom = document.getElementById('chartDom')!;
  var myChart = echarts.init(chartDom);
  var option: EChartsOption;
  option = {
    legend: {
      data: ['Allocated Budget', 'Actual Spending']
    },
    radar: {
      // shape: 'circle',
      indicator: [
        { name: '语文', max: 150, color: '#6F55FF' },
        { name: '数学', max: 150, color: '#C400FF' },
        { name: '英语', max: 150, color: '#FF0004' },
        { name: '历史', max: 100, color: '#FF6400' },
        { name: '政治', max: 100, color: '#17B99C' },
        { name: '化学', max: 100, color: '#FB0' },
        { name: '物理', max: 100, color: '#007BFF' },
      ]
    },
    series: [
      {
        type: 'radar',
        data: [
          {
            value: [144, 134, 127, 78, 90, 69],
            lineStyle: {
              color: '#FF6400',
            },
            itemStyle: {
              color: '#FF6400',
            }
          },
        ]
      }
    ]
  };

  option && myChart.setOption(option);
})
</script>

<style lang="scss" scoped>
.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding: 10vh 20px;
  background-color: #F5F6F8;
  .box {
    width: calc(100vw - 280px);
    border-radius: 6px;
    background: #FFF;
    padding: 0 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    .icon {
      width: 180px;
      height: 180px;
      display: block;
    }
    .title {
      color: #333;
      font-size: 20px;
    }
    .radar {
      width: 316px;
      height: 275px;
    }
    .fraction {
      color: #000;
      font-size: 24px;
      font-weight: 600;
      margin-bottom: 24px;
      span {
        color: #6F55FF;
      }
    }
    .statistics {
      width: 800px;
      height: 169px;
      flex-shrink: 0;
      border-radius: 10px;
      border: 0.8px solid rgba(111, 85, 255, 0.50);
      background: #FCFCFC;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 16px;
      margin-bottom: 36px;
      .statistics-item {
        display: flex;
        align-items: center;
        .statistics-name {
          display: flex;
          align-items: center;
          gap: 12px;
          font-size: 20px;
          margin-right: 105px;
          img {
            width: 20px;
            height: auto;
            display: block;
          }
        }
        .statistics-type {
          margin-right: 50px;
          font-size: 20px;
        }
        .statistics-num {
          font-size: 20px;
        }
      }
    }
    .btn {
      width: 400px;
      height: 60px;
      line-height: 60px;
      border-radius: 100px;
      background: #6F55FF;
      color: #FFF;
      font-size: 20px;
      text-align: center;
          }
  }
}
.modal-title {
  position: relative;
  width: 216px;
  height: 120px;
  padding-top: 30px;
  font-size: 24px;
  font-weight: 500;
  img {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    width: auto;
    height: 120px;
    transform: translateX(calc(100% + 16px));
  }
}
.modal-input {
  width: 667px;
  height: 80px;
  border-radius: 10px;
  border: 0.6px solid #D4D4D4;
  background: #FFF;
  font-size: 20px;
  margin: 0 auto;
  margin-bottom: 22px;
}
.ai-tips {
  color: #333;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 65px;
  span {
    color: #FF6400;
    font-weight: 600;
  }
  img {
    width: 28px;
    height: auto;
    display: block;
  }
}
.modal-btn {
  width: 400px;
  height: 60px;
  line-height: 60px;
  border-radius: 100px;
  background: #6F55FF;
  color: #FFF;
  font-size: 20px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 56px;
}
</style>